<?php
require_once('lib/gymnasium.php');
$is_admin = $_SESSION['status_code'] == 'ADMIN';
?>

<h3>Gymnases</h3>
<table class="dataTable">
	<thead>
	<tr>
		<th>Nom</th>
		<th>Adresse</th>
		<?php echo $is_admin ? '<th>Action</th>' : ''; ?>
	</tr>
	</thead>
	<tbody>
	<?php
	$gyms = gym_get_list();
	while ($row = mysql_fetch_assoc($gyms)) {
		echo '
		<tr>
			<td><strong>'.$row['name'].'</strong></td>
			<td>'.$row['address'].'<br/>'
				.$row['postal_code'].' '.$row['city'].'</td>';
			if ($is_admin) {
				echo '
				<td>
					<a href="?p=club&amp;r=gym_edit&amp;id='.$row['id'].'" title="Modifier">
						<img src="images/icons/pencil.png" alt="edit" />
					</a>&nbsp;
					<a href="gymnases-details-'.$row['id'].'.html" title="Aller à la page publique de ce gymnase">
						<img src="images/icons/page_white_go.png" alt="go" />
					</a>
				</td>';
			}
			echo '
		</tr>';
	}
	?>
	</tbody>
</table>
